package com.heima.comment.controller;

import com.heima.comment.service.ApCommentService;
import com.heima.model.comment.dtos.CommentRepayDto;
import com.heima.model.comment.dtos.CommentRepayLikeDto;
import com.heima.model.comment.dtos.CommentRepaySaveDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/api/v1/comment_repay")
@RequiredArgsConstructor
public class ApCommentRepayController {

    private final ApCommentService apCommentService;

    /**
     * 评论回复保存
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody CommentRepaySaveDto dto) {
        log.info("评论回复保存：{}", dto);
        return apCommentService.repaySave(dto);
    }

    /**
     * 评论回复加载
     * @param dto
     * @return
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentRepayDto dto) {
        log.info("评论回复加载：{}", dto);
        return apCommentService.repayLoad(dto);
    }

    /**
     * 评论回复点赞
     * @param dto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentRepayLikeDto dto) {
        log.info("评论回复点赞：{}", dto);
        return apCommentService.repayLike(dto);
    }
}
